toTOML

Convert a JSONValue to a TOMLValue.

toTOML
(
JSONValue json
)

Throws

TOMLException if the array values have different types TOMLExcpetion if a floating point value is not finite TOMLException if the json value is null

Examples

1 try
2 {
3 	// null
4 	toTOML(JSONValue.init);
5 	assert(0);
6 }
7 catch (TOMLException)
8 {
9 }
10 
11 assert(toTOML(JSONValue(true)).type == TOML_TYPE.TRUE);
12 assert(toTOML(JSONValue(false)) == false);
13 assert(toTOML(JSONValue("test")) == "test");
14 assert(toTOML(JSONValue(42)) == 42);
15 assert(toTOML(JSONValue(ulong.max)) == -1);
16 assert(toTOML(JSONValue(.1)) == .1);
17 assert(toTOML(JSONValue([1, 2, 3])) == [1, 2, 3]);
18 assert(toTOML(JSONValue(["a" : 1, "b" : 2])) == ["a" : 1, "b" : 2]);

Meta